package com.gome.ocean.common.utils;

import java.util.List;
import java.util.TreeMap;
import java.util.TreeSet;

public final class DBCharUtils {

    public static TreeMap<String, TreeSet<String>> sort(List<String> tables) {
        TreeMap<String, TreeSet<String>> sortMaps = new TreeMap<String, TreeSet<String>>();
        for (String table : tables) {
            char c = table.charAt(0);
            String key = String.valueOf(c);
            if (sortMaps.containsKey(key)) {
                sortMaps.get(key).add(table);
            } else {
                TreeSet<String> values = new TreeSet<String>();
                values.add(table);
                sortMaps.put(key, values);
            }
        }
        return sortMaps;
    }
}
